/**
 * ${table.comment!} 新增/修改对话框表单
 */

import React from "react";
import { Form, Row, Col, Input, Modal } from "antd";
import { FormValidItem } from "win-trade-base";
import ${entity}ModalController from "../controller/${entity}ModalController";

const formItemLayout = {
    labelCol: {
        sm: { span: 8 }
    },
    wrapperCol: {
        sm: { span: 16 }
    }
};

class ${entity}EditForm extends React.Component {

    render() {

        const { getFieldDecorator } = this.props.form;
        const ${entity?uncap_first} = this.props.editData;
        return (
            <div>
                <Form colon={false}>
                    <Row>
        <#-- ----------  BEGIN 字段循环遍历  ---------->
        <#list table.fields as field>
                        <Col span={12}>
                            <FormValidItem label="${field.comment}" {...formItemLayout}>
                                {getFieldDecorator("${field.propertyName}", {
                                    initialValue: ${entity?uncap_first}.${field.propertyName}
                                })(<Input style={{ width: 200 }} />)}
                            </FormValidItem>
                        </Col>
        </#list>
                    </Row>
                </Form >
            </div>
        );
    }
}

const Wrapped${entity}EditForm = Form.create()(${entity}EditForm);

export default class ${entity}Modal extends ${entity}ModalController {
    render() {
        return (
            <Modal
                title={this.state.isAdd ? `${table.comment!}` : `${table.comment!}`}
                okText="确定"
                cancelText="取消"
                destroyOnClose={true}
                width={1080}
                maskClosable={false}
                visible={this.state.showModal}
                onOk={this.handleOk}
                onCancel={this.handleCancel}
                centered
            >
                <Wrapped${entity}EditForm
                    {...this.props}
                    {...this.state}
                    wrappedComponentRef={ref => this.$${entity?uncap_first}EditForm = ref}
                />
            </Modal >)
    }
}
